package com.demo;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;

public class MyPojo  implements InitializingBean,DisposableBean{

	private int x;

	public int getX() {
		return x;
	}

	public void setX(int x) {
		this.x = x;
	}

	@Override
	public String toString() {
		return "MyPojo [x=" + x + "]";
	}

	
	public void initPojo(){
		System.out.println("startup method executed..");
	}
	
	public void destroyPojo(){
		System.out.println("destroy method is called..");
	}
	
	@Override
	public void afterPropertiesSet() throws Exception {
	
		   System.out.println("after property set method is called..");
	}
	
	@Override
	public void destroy() throws Exception {
		 System.out.println("Destroy method is called through disposable bean..");
	}
	
	@PostConstruct
	public void init(){
		
		System.out.println("init method through annotaion");
	}
	
	@PreDestroy
	public void destoryByAnnotation(){
		
		System.out.println("destroy method through  annotaion..");
	}
	
	
}
